; (function (global, factory) {
	if (typeof module === "object" && typeof module.exports === "object") {
		module.exports = factory(global);
	} else {
		factory(global);
	}
})(typeof window !== "undefined" ? window : this, function (window) {
	var barcodeUtil = {};
	barcodeUtil.ean13 = {
		parse: function (s) {
			try {
				if (!s) return "";
				s = s.replace(/^\s+|\s+$/gm, '');
				if (s.length !== 13) return "";
				var A = 0;
				var B = 0;
				var i;
				for (i = 0; i < 12; i++) {
					if (i % 2 == 1) {
						A += parseInt(s[i]);
					}
					else {
						B += parseInt(s[i]);
					}
				}
				var cc = (10 - (B + A * 3) % 10) % 10;
				return cc == parseInt(s[12], 10) ? s : "";
			} catch(e){
				return "";
			}
		}
	};
	window.utils = window.utils || {};
	window.utils.barcode = barcodeUtil;
});